package com.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the orders database table.
 * 
 */
@Entity
@Table(name="orders")
@NamedQuery(name="Order.findAll", query="SELECT o FROM Order o")
public class Order implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String orderid;

	@Temporal(TemporalType.DATE)
	@Column(name="orderend_time")
	private Date orderendTime;

	private BigDecimal ordermoney;

	private String orderremarks;

	@Temporal(TemporalType.DATE)
	@Column(name="orderstart_time")
	private Date orderstartTime;

	private String orderstate;

	private String ordertheme;

	//bi-directional many-to-one association to Orderdetail
	@OneToMany(mappedBy="order")
	private List<Orderdetail> orderdetails;

	//bi-directional many-to-one association to Customer
	@ManyToOne
	@JoinColumn(name="cid")
	private Customer customer;

	//bi-directional many-to-one association to Staff
	@ManyToOne
	@JoinColumn(name="staffid")
	private Staff staff;

	//bi-directional many-to-one association to Plannedreturn
	@OneToMany(mappedBy="order")
	private List<Plannedreturn> plannedreturns;

	//bi-directional many-to-one association to Returned
	@OneToMany(mappedBy="order")
	private List<Returned> returneds;

	//bi-directional many-to-one association to Send
	@OneToMany(mappedBy="order")
	private List<Send> sends;

	public Order() {
	}

	public String getOrderid() {
		return this.orderid;
	}

	public void setOrderid(String orderid) {
		this.orderid = orderid;
	}

	public Date getOrderendTime() {
		return this.orderendTime;
	}

	public void setOrderendTime(Date orderendTime) {
		this.orderendTime = orderendTime;
	}

	public BigDecimal getOrdermoney() {
		return this.ordermoney;
	}

	public void setOrdermoney(BigDecimal ordermoney) {
		this.ordermoney = ordermoney;
	}

	public String getOrderremarks() {
		return this.orderremarks;
	}

	public void setOrderremarks(String orderremarks) {
		this.orderremarks = orderremarks;
	}

	public Date getOrderstartTime() {
		return this.orderstartTime;
	}

	public void setOrderstartTime(Date orderstartTime) {
		this.orderstartTime = orderstartTime;
	}

	public String getOrderstate() {
		return this.orderstate;
	}

	public void setOrderstate(String orderstate) {
		this.orderstate = orderstate;
	}

	public String getOrdertheme() {
		return this.ordertheme;
	}

	public void setOrdertheme(String ordertheme) {
		this.ordertheme = ordertheme;
	}

	public List<Orderdetail> getOrderdetails() {
		return this.orderdetails;
	}

	public void setOrderdetails(List<Orderdetail> orderdetails) {
		this.orderdetails = orderdetails;
	}

	public Orderdetail addOrderdetail(Orderdetail orderdetail) {
		getOrderdetails().add(orderdetail);
		orderdetail.setOrder(this);

		return orderdetail;
	}

	public Orderdetail removeOrderdetail(Orderdetail orderdetail) {
		getOrderdetails().remove(orderdetail);
		orderdetail.setOrder(null);

		return orderdetail;
	}

	public Customer getCustomer() {
		return this.customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public Staff getStaff() {
		return this.staff;
	}

	public void setStaff(Staff staff) {
		this.staff = staff;
	}

	public List<Plannedreturn> getPlannedreturns() {
		return this.plannedreturns;
	}

	public void setPlannedreturns(List<Plannedreturn> plannedreturns) {
		this.plannedreturns = plannedreturns;
	}

	public Plannedreturn addPlannedreturn(Plannedreturn plannedreturn) {
		getPlannedreturns().add(plannedreturn);
		plannedreturn.setOrder(this);

		return plannedreturn;
	}

	public Plannedreturn removePlannedreturn(Plannedreturn plannedreturn) {
		getPlannedreturns().remove(plannedreturn);
		plannedreturn.setOrder(null);

		return plannedreturn;
	}

	public List<Returned> getReturneds() {
		return this.returneds;
	}

	public void setReturneds(List<Returned> returneds) {
		this.returneds = returneds;
	}

	public Returned addReturned(Returned returned) {
		getReturneds().add(returned);
		returned.setOrder(this);

		return returned;
	}

	public Returned removeReturned(Returned returned) {
		getReturneds().remove(returned);
		returned.setOrder(null);

		return returned;
	}

	public List<Send> getSends() {
		return this.sends;
	}

	public void setSends(List<Send> sends) {
		this.sends = sends;
	}

	public Send addSend(Send send) {
		getSends().add(send);
		send.setOrder(this);

		return send;
	}

	public Send removeSend(Send send) {
		getSends().remove(send);
		send.setOrder(null);

		return send;
	}

}